Class 6 Exam  >  Class 6 Questions  >  What is the output of C Program with Switch S... Start Learning for Free
What is the output of C Program with Switch Statement?
int main()
{
    
    int a=5;
    
    switch(a)
    {
        case 0: printf("0 ");
        case 3: printf("3 ");
        case 5: printf("5 ");
        default: printf("RABBIT ");
    }
    
    a=10;
    switch(a)
    {
        case 0: printf("0 ");
        case 3: printf("3 ");
        case 5: printf("5 ");
        default: printf("RABBIT "); break;
    }
    
    return 0;
}
  • a)
    5 RABBIT
  • b)
    0 3 5 RABBIT 0 3 5 RABBIT
  • c)
    0 3 5 RABBIT RABBIT
  • d)
    3 5 RABBIT RABBIT
Correct answer is option 'D'. Can you explain this answer?
Most Upvoted Answer
What is the output of C Program with Switch Statement?int main(){ in...
Absence of break; after case statement causes control to go to next case automatically. So after matching 3 with a==3, program prints 3 and control falls down the ladder without checking case again printing everything below it. So Switch checks only once and falls down.
Explore Courses for Class 6 exam
Question Description
What is the output of C Program with Switch Statement?int main(){ int a=5; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); } a=10; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); break; } return 0;}a)5 RABBITb)0 3 5 RABBIT 0 3 5 RABBITc)0 3 5 RABBIT RABBITd)3 5 RABBIT RABBITCorrect answer is option 'D'. Can you explain this answer? for Class 6 2025 is part of Class 6 preparation. The Question and answers have been prepared according to the Class 6 exam syllabus. Information about What is the output of C Program with Switch Statement?int main(){ int a=5; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); } a=10; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); break; } return 0;}a)5 RABBITb)0 3 5 RABBIT 0 3 5 RABBITc)0 3 5 RABBIT RABBITd)3 5 RABBIT RABBITCorrect answer is option 'D'. Can you explain this answer? covers all topics & solutions for Class 6 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What is the output of C Program with Switch Statement?int main(){ int a=5; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); } a=10; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); break; } return 0;}a)5 RABBITb)0 3 5 RABBIT 0 3 5 RABBITc)0 3 5 RABBIT RABBITd)3 5 RABBIT RABBITCorrect answer is option 'D'. Can you explain this answer?.
Solutions for What is the output of C Program with Switch Statement?int main(){ int a=5; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); } a=10; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); break; } return 0;}a)5 RABBITb)0 3 5 RABBIT 0 3 5 RABBITc)0 3 5 RABBIT RABBITd)3 5 RABBIT RABBITCorrect answer is option 'D'. Can you explain this answer? in English & in Hindi are available as part of our courses for Class 6. Download more important topics, notes, lectures and mock test series for Class 6 Exam by signing up for free.
Here you can find the meaning of What is the output of C Program with Switch Statement?int main(){ int a=5; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); } a=10; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); break; } return 0;}a)5 RABBITb)0 3 5 RABBIT 0 3 5 RABBITc)0 3 5 RABBIT RABBITd)3 5 RABBIT RABBITCorrect answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What is the output of C Program with Switch Statement?int main(){ int a=5; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); } a=10; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); break; } return 0;}a)5 RABBITb)0 3 5 RABBIT 0 3 5 RABBITc)0 3 5 RABBIT RABBITd)3 5 RABBIT RABBITCorrect answer is option 'D'. Can you explain this answer?, a detailed solution for What is the output of C Program with Switch Statement?int main(){ int a=5; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); } a=10; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); break; } return 0;}a)5 RABBITb)0 3 5 RABBIT 0 3 5 RABBITc)0 3 5 RABBIT RABBITd)3 5 RABBIT RABBITCorrect answer is option 'D'. Can you explain this answer? has been provided alongside types of What is the output of C Program with Switch Statement?int main(){ int a=5; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); } a=10; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); break; } return 0;}a)5 RABBITb)0 3 5 RABBIT 0 3 5 RABBITc)0 3 5 RABBIT RABBITd)3 5 RABBIT RABBITCorrect answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What is the output of C Program with Switch Statement?int main(){ int a=5; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); } a=10; switch(a) { case 0: printf("0 "); case 3: printf("3 "); case 5: printf("5 "); default: printf("RABBIT "); break; } return 0;}a)5 RABBITb)0 3 5 RABBIT 0 3 5 RABBITc)0 3 5 RABBIT RABBITd)3 5 RABBIT RABBITCorrect answer is option 'D'. Can you explain this answer? tests, examples and also practice Class 6 tests.
Explore Courses for Class 6 exam
Signup to solve all Doubts
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev